package com.lihua.framework.websocket.session;

import javax.websocket.Session;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author lihua
 * @date 2022/4/8 21:58
 * ws会话
 */
public class WsSession {
    /** 存放所有在线的客户端 */
    private final static Map<String, Session> CLIENTS = new ConcurrentHashMap<>();

    public static Session getSession(String key){
        return CLIENTS.get(key);
    }

    public static void putSession(String key,Session session){
       CLIENTS.put(key,session);
    }

    public static void remove(String key){
        CLIENTS.remove(key);
    }

}
